<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>嵌套路由</title>
    
    <script src="./../vue/vue.js"></script>
    <script src="./../vue/vue-router.js"></script>
</head>
<body>

    <!-- 
        嵌套路由
        const router = new VueRouter({
            routes: [
                {
                    path: '/pathname',
                    component: ComponentA,
                    childred: [
                        {
                            path: 'childpath',
                            component: ChildComponent
                        }
                    ]
                }
            ]
        })

     -->

    <div id="app">
        <div>嵌套路由</div>
        <router-view></router-view>
    </div>

    

    <script>

        const User = {
            template: `
            <div>
                <div>User组件</div>
                <router-view></router-view>
            </div>
            `
        }

        const Userson = {
            template: `
            <div>son</div>
            `
        }
        
        const router = new VueRouter({
            routes: [
                {
                    path: '/user',
                    component: User,
                    children:[
                        {
                            path: 'userson',
                            component: Userson
                        }
                    ]
                }
            ]
        })


        let vm = new Vue({
            router,
            el: "#app",
            data: {

            },
            methods: {
                
            },
        })

    </script>
    
</body>
</html>